<template>
  <el-button text @click="dialogFormVisible = true">
   
  </el-button>
  
  {{info}}
  <el-dialog v-model="dialogFormVisible" :title="oneZhi">
    <el-form :model="form">
      <el-form-item label="Promotion name" :label-width="formLabelWidth">
        <el-input v-model="form.name" autocomplete="off" />
      </el-form-item>
      <el-form-item label="Zones" :label-width="formLabelWidth">
        <el-select v-model="form.region" placeholder="Please select a zone">
          <el-option label="Zone No.1" value="shanghai" />
          <el-option label="Zone No.2" value="beijing" />
        </el-select>
      </el-form-item>
    </el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="dialogFormVisible = false">Cancel</el-button>
        <el-button type="primary" @click="dialogFormVisible = false">
          Confirm
        </el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script lang="ts" setup>
import { reactive, ref ,defineProps,toRefs} from "vue";

const props = defineProps({
  //子组件接收父组件传递过来的值
  info: Object,
  oneZhi:String
})
//使用父组件传递过来的值
const {info,oneZhi} =toRefs(props)



const dialogFormVisible = ref(false);
const formLabelWidth = "140px";

const form = reactive({
  name: "",
  region: "",
  date1: "",
  date2: "",
  delivery: false,
  type: [],
  resource: "",
  desc: "",
});
const showDio = () => {
  dialogFormVisible.value = true;
  console.log('====================================');
  console.log(info);
  console.log(oneZhi);
  
  console.log('====================================');
};

//暴露showDio方法
defineExpose({
    form,
  dialogFormVisible,
  oneZhi,
  showDio,
});
</script>
<style scoped>
.el-button--text {
  margin-right: 15px;
}
.el-select {
  width: 300px;
}
.el-input {
  width: 300px;
}
.dialog-footer button:first-child {
  margin-right: 10px;
}
</style>